<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
昵称：<input type="text" name="name"><br>
真实姓名：<input type="text" name="trueName"><br>
身份证：<input type="text" name="cardId"><br>
邮箱：<input type="text" name="email"><br>
电话号码：<input type="text" name="telephone"><br>
QQ号码：<input type="text" name="qqId"><br>
账户密码：<input type="text" name="pwd"><br>
问题：<input type="text" name="question"><br>
答案：<input type="text" name="answer"><br>
状态：<input type="text" name="state"><br>
<input id="button-user" type="button" value="添加用户" >
<script src="js/jquery-1.11.0.min.js"></script>
<script>
    $(function () {
        $("#button-user").click(function () {
            var name=$("[name='name']").val();
            var trueName=$("[name='trueName']").val();
            var cardId=$("[name='cardId']").val();
            var email=$("[name='email']").val();
            var telephone=$("[name='telephone']").val();
            var qqId=$("[name='qqId']").val();
            var pwd=$("[name='pwd']").val();
            var question=$("[name='question']").val();
            var answer=$("[name='answer']").val();
            var state=$("[name='state']").val();
            $.ajax({
                type:"post",
                url:"http://localhost:9527/exam2_Web_exploded/addUser",
                data:{"name":name,"trueName":trueName,"cardId":cardId,"email":email,"telephone":telephone,"qqId":qqId,"pwd":pwd,
                       "question":question,"answer":answer,"state":state },
                success:function (res) {
                    if (res.code==1){
                        alert(res.massage)
                        $(location).attr('href',"http://localhost:9527/exam2_Web_exploded/manageUser.html")
                    }else {
                        alert(res.massage)
                    }
                }
            })
        })
    })
</script>
</body>
</html>